﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KeRui.Common;
using System.Collections.Generic;


public partial class Manage_Cms_SystemwshyItem : System.Web.UI.Page
{
    protected string Pic = "";
    protected string Html = "";
    protected string TempalteNum = "";
    protected string act = PageRequest.GetString("act");
    protected KeRui.BLL.CmsTemplateFileAttr BllCmsTemplateFileAttr = new KeRui.BLL.CmsTemplateFileAttr();
    protected KeRui.Model.CmsTemplateFileAttr ModelCmsTemplateFileAttr = new KeRui.Model.CmsTemplateFileAttr();
    protected int ID = PageRequest.GetInt("id", -1);
    protected int TemplateID = PageRequest.GetInt("TemplateID", -1);
    protected void Page_Load(object sender, EventArgs e)
    {
        //检查管理员登录HYC
        ManageHelper.CheckAdminLogin();
        KeRui.BLL.CmsTemplateFile BLLCmsTemplateFile = new KeRui.BLL.CmsTemplateFile();
        KeRui.Model.CmsTemplateFile ModelCmsTemplateFile = new KeRui.Model.CmsTemplateFile();
        ModelCmsTemplateFile = BLLCmsTemplateFile.GetModel(ID);
        ModelCmsTemplateFileAttr = (BllCmsTemplateFileAttr.GetList("FileID=" + ModelCmsTemplateFile.FileID, 1, 1))[0];
        if (ModelCmsTemplateFileAttr == null)
        {
            ModelCmsTemplateFileAttr = new KeRui.Model.CmsTemplateFileAttr();
        }
        if (act == "save")
        {
            Pic = PageRequest.GetString("pic");
            Html = PageRequest.GetString("html");
            TempalteNum = PageRequest.GetString("TempalteNum");
            ModelCmsTemplateFileAttr.HtmlPath = Html;
            ModelCmsTemplateFileAttr.PicPath = Pic;
            ModelCmsTemplateFileAttr.Notes = TempalteNum;
            BllCmsTemplateFileAttr.Update(ModelCmsTemplateFileAttr);
            Response.Write("<script type=\"text/javascript\">window.parent.location.href='SystemwshyList.aspx?TemplateID=" + TemplateID + "&sucmsg=恭喜。匹配成功。'</script>");
        }
        else
        {
            Pic = ModelCmsTemplateFileAttr.PicPath;
            Html = ModelCmsTemplateFileAttr.HtmlPath;
            TempalteNum = ModelCmsTemplateFileAttr.Notes;
        }
    }
}
